﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Exentials.Xoox.Styles
{
    public class XFormat : XElementBase
    {
        private XCellAlignment _alignment;
        private XAttributeBase<int> _numFmtId;
        private XAttributeBase<int> _fontId;
        private XAttributeBase<int> _fillID;
        private XAttributeBase<int> _borderId;
        private XAttributeBase<int> _xfId;
        private XAttributeBase<bool> _quotePrefix;
        private XAttributeBase<bool> _pivotButton;
        private XAttributeBase<bool> _applyNumberFormat;
        private XAttributeBase<bool> _applyFont;
        private XAttributeBase<bool> _applyFill;
        private XAttributeBase<bool> _applyBorder;
        private XAttributeBase<bool> _applyAlignment;
        private XAttributeBase<bool> _applyProtection;

        public XFormat()
            : base("xf")
        {
            _numFmtId = new XAttributeBase<int>(this, "numFmtId");
            _fontId = new XAttributeBase<int>(this, "fontId");
            _fillID = new XAttributeBase<int>(this, "fillId");
            _borderId = new XAttributeBase<int>(this, "borderId");
            _xfId = new XAttributeBase<int>(this, "xfId");
            _quotePrefix = new XAttributeBase<bool>(this, "quotePrefix");
            _pivotButton = new XAttributeBase<bool>(this, "pivotButton");
            _applyNumberFormat = new XAttributeBase<bool>(this, "applyNumberFormat");
            _applyFont = new XAttributeBase<bool>(this, "applyFont");
            _applyFill = new XAttributeBase<bool>(this, "applyFill");
            _applyBorder = new XAttributeBase<bool>(this, "applyBorder");
            _applyAlignment = new XAttributeBase<bool>(this, "applyAlignment");
            _applyProtection = new XAttributeBase<bool>(this, "applyProtection");
        }

        public XCellAlignment Alignment
        {
            get
            {
                if (_alignment == null) this.Add(_alignment = new XCellAlignment());
                return _alignment;
            }
        }

        public int NumFmtId
        {
            get { return _numFmtId.Value; }
            set { _numFmtId.Value = value; }
        }

        public int FontId
        {
            get { return _fontId.Value; }
            set { _fontId.Value = value; }
        }

        public int FillId
        {
            get { return _fillID.Value; }
            set { _fillID.Value = value; }
        }

        public int BorderId
        {
            get { return _borderId.Value; }
            set { _borderId.Value = value; }
        }

        public int XfId
        {
            get { return _xfId.Value; }
            set { _xfId.Value = value; }
        }

        public bool QuotePrefix
        {
            get { return _quotePrefix.Value; }
            set { _quotePrefix.Value = value; }
        }

        public bool PivotButton
        {
            get { return _pivotButton.Value; }
            set { _pivotButton.Value = value; }
        }

        public bool ApplyNumberFormat
        {
            get { return _applyNumberFormat.Value; }
            set { _applyNumberFormat.Value = value; }
        }

        public bool ApplyFont
        {
            get { return _applyFont.Value; }
            set { _applyFont.Value = value; }
        }

        public bool ApplyFill
        {
            get { return _applyFill.Value; }
            set { _applyFill.Value = value; }
        }

        public bool ApplyBorder
        {
            get { return _applyBorder.Value; }
            set { _applyBorder.Value = value; }
        }

        public bool ApplyAlignment
        {
            get { return _applyAlignment.Value; }
            set { _applyAlignment.Value = value; }
        }

        public bool ApplyProtection
        {
            get { return _applyProtection.Value; }
            set { _applyProtection.Value = value; }
        }
    }
}

